package com.zxy.controller;

import com.zxy.feignclient.HystrixClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Zxy
 * @Date: 2021-06-11
 **/
@RestController
public class TestDemoController {

    // 注入OpenFeign客户端
    @Qualifier("com.zxy.feignclient.HystrixClient")
    @Autowired
    private HystrixClient hystrixClient;

    @GetMapping("/test")
    public String test() {
        System.out.println("test ok");
        String demo = hystrixClient.demo(-1);
        System.out.println("demo = " + demo);
        return "test ok";
    }
}
